﻿package mortal.game.scene3D.swf3D
{
    import baseEngine.basic.*;
    import baseEngine.system.*;
    import com.gengine.global.*;
    import frEngine.animateControler.keyframe.*;
    import frEngine.animateControler.uvControler.*;
    import frEngine.core.*;
    import frEngine.effectEditTool.parser.*;
    import frEngine.primitives.*;
    import mortal.game.scene3D.layer3D.utils.*;

    public class Swf3DPlayer extends FrPlane
    {
        private var swf3dinfo:Swf3DInfo;

        public function Swf3DPlayer()
        {
            super("");
            this.rotationX = Scene3DUtil._cameraAngle;
            this.material.materialParams.colorKillvalue = 0;
            ParserLayerObject.instance.parserAlphaKil(this.material.materialParams, true, 0.01);
            return;
        }// end function

        public function loadSwf(param1:String, param2:RenderList = null) : void
        {
            this.renderList = param2;
            var _loc_3:* = this.swf3dinfo;
            this.swf3dinfo = Swf3DInfo.getSwfInfo(param1);
            if (_loc_3 == this.swf3dinfo)
            {
                return;
            }
            if (this.swf3dinfo.isloaded)
            {
                this.onLoaded(this.swf3dinfo);
            }
            else
            {
                this.swf3dinfo.addWaiter(this);
            }
            return;
        }// end function

        override public function dispose(param1:Boolean = true) : void
        {
            super.dispose(param1);
            this.swf3dinfo = null;
            return;
        }// end function

        public function onLoaded(param1:Swf3DInfo) : void
        {
            var _loc_2:* = param1.skipFrame;
            var _loc_3:* = this.getAnimateControlerInstance(AnimateControlerType.UvStepControler) as FrUvStepControler;
            var _loc_4:* = Global.stage.frameRate == 60 ? (_loc_2 * 2) : (_loc_2);
            _loc_3.init(param1.widthNum, param1.heightNum, param1.imgNum, _loc_4, 1, 0, false);
            if (!this.renderList)
            {
                this.renderList = Global3D.scene.renderLayerList;
            }
            this.reinit(this.renderList, param1.width, param1.height, param1.bitmapData, false, null, "-xy");
            this.setMateiralBlendMode(EBlendType.BLEND_ALPHA0);
            return;
        }// end function

    }
}
